#define DTP 10
#include "nPatriciaTrie.h"
#include "tagdefs.h"
#include "strfunc.h"
int main() {
	nPatriciaTrie<char>* test;
	nPatriciaTrieNode<char>* node;
	linkedlist *t;
	char buff[100];
	char *loc;
	bool ab=true;
	int i;
	test = new nPatriciaTrie<char>();
	printf("Trie Initialized\n");
	for (i=0;i<10000;i++) {
		sprintf(buff,"/home/nandakiran/test/dad/%ld",i);
		loc=strdup(buff);
		if (loc!=NULL)
			test->Insert(loc,' ');
		else {
			printf("Not enough memory!\n");
			break;
		}
	}
	printf("Items in Trie : %ld\n",test->triesize);
	for (i=100;i<600;i++) {
		sprintf(buff,"/home/nandakiran/test/dad/%ld",i);
		node=test->LookupNode(buff);
		if (node!=NULL) {
			loc=node->GetKey();
			test->Delete(buff);
			free(loc);
		}
	}
	printf("Items in Trie : %ld\n",test->triesize);
	char *ch,*ch1;
//	t=test->getPartialList("/home/nandakiran/test/dad/1");
	t=test->GetKey(100);
	ch=t->remove();
	printf("%s\n",ch);
	//ch1=strdup(ch);
	free(ch);
	delete t;
	/*
	ch=test->GetRandomKey();
	printf("%s\n",ch);
	free(ch);
	*/
	test->deleteMemory();
	delete test;
}
